﻿/* 
┏━━━━━━━━━━━＼／━━━━━━━━━━━┓      
┃┏━━━━━━━━━━━━━━━━━━━━━━┓┃
     ------------------------------------------    
       Author           : TengSea   
       Created          : Mouth-Day-Year                              
       Last Modified By : TengSea                                 
       Last Modified On : Mouth-Day-Year                                                               
       Description      : 
     __________________________________________
     Copyright (c) TengSea. All rights reserved.
 ┃┗━━━━━━━━━━━━━━━━━━━━━━┛┃                            
 ┗━━━━━━━━━∪━━━━∪━━━━━━━━━┛
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hhmocon.Mes.Util.String
{
    /// <summary>
    /// sql语句拼装
    /// </summary>
    public class SqlAssemble
    {
        /// <summary>
        /// 为sql语句的查询条件追加 假删除条件
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public string Delete_Mark_Assemble(string sql) {
            //如果语句非空就添加
            if (!string.IsNullOrEmpty(sql))
            {
                sql += " AND DELETE_MARK = '0'";
                return sql;
            }
            else
            {
                sql += " DELETE_MARK = '0'";
                return sql;
            }

        }

        
        /// <summary>
        /// 获取泛型的类名
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public string getClassName<T>()
        {
            //截取最后一个.往后的内容
            int index = typeof(T).ToString().LastIndexOf(".");
            string className = typeof(T).ToString();
            className = className[(index + 1)..];
            return className;
        }


    }
}
